using System.Diagnostics.CodeAnalysis;
using iPhOwa.Exchange.Attributes;
using iPhOwa.Exchange.ContentClasses.Fields;

namespace iPhOwa.Exchange.ContentClasses
{
	/// <summary>
	/// The base class for all folder types.
	/// </summary>
	[ExchangeContentClass(ContentClassNames.Folder)]
	public class Folder : Item
	{
		/// <summary>
		/// Number of unread items.
		/// </summary>
		[ExchangeField(FolderFields.UnreadCount)]
		public long UnreadCount
		{
			get;
			set;
		}

		/// <summary>
		/// Get the display images for this folder.
		/// </summary>
		[SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase")]
		[SuppressMessage("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")]
		public string ImageUrl
		{
			get
			{
				switch(ContentClass)
				{
					case ContentClassNames.MailFolder:

						switch(DisplayName.ToLowerInvariant())
						{
							case "inbox":

								return "~/Images/inbox.gif";

							case "drafts":

								return "~/Images/drafts.gif";

							case "junk e-mail":

								return "~/Images/junkemail.gif";
						}

						break;

					case ContentClassNames.Folder:

						switch(DisplayName.ToLowerInvariant())
						{
							case "outbox":

								return "~/Images/outbox.gif";

							case "sent items":

								return "~/Images/sent-items.gif";

							case "deleted items":

								return "~/Images/deleted.gif";
						}

						break;

					case ContentClassNames.CalendarFolder:

						return "~/Images/icon-appt.gif";

					case ContentClassNames.ContactFolder:

						return "~/Images/icon-contact.gif";

					case ContentClassNames.JournalFolder:

						return "~/Images/icon-journal.gif";

					case ContentClassNames.NoteFolder:

						return "~/Images/notes.gif";

					case ContentClassNames.TaskFolder:

						return "~/Images/icon-task.gif";
				}

				return "~/Images/icon-folder.gif";
			}
		}
	}
}